I thought I could do this with just CSS, but it's not working.
I have an html file header that contains the website banner and navigation bar.
The nav bar is a <ul> list of links to the various pages, and CSS makes them look like buttons.
I include that file using an <iframe> element in my other pages.
when a user clicks a menu button (about us, home, etc.) the change in color isn't saved. The hover works - so it looks selected - and then the new page comes up and the selection disappears.
If I want to use a js script to force it to check highlighting, how do I get at the <li> elements? If I'm in index.html, for example, I have the <iframe> element, but I wouldn't think that the current document would conain the <li> elements of the navigation bar. If I'm in the header.html, then I don't know what page I'm on (i.e. what page is including the header) to know which menu item should be highlighted.
Any ideas on how I can do this?
Thanks!
3 4221
The iframe document contains the li elements, so once you have that you can loop through to get them. As for saving the colour change, you can use a cookie or the URL to save the change. If you're using a server-side language, remove the iframe and include the navigation in each page.
Thanks for the quick reply!
I solved my problem by having one file with the header and footer, and loading the other pages into an iframe in the center of that file - depending upon which navigation button the user clicks.
now I have a new problem. I have a contact form, and want to do some validation. I added a:
onsubmit="return validateForm()"
to the form tag, and I am testing with bad data to see the errors (which are spans to the right of the fields. If there's an error, the innerHTML of the span is filled in, otherwise, nothing appears there.) so I know that the validateForm() is returning false.
Here's the problem -- the whole current page is trying to fit in the iframe in the center of the page. I'm not seeing the form at all, but I get two headers, two nav bars -- seriously ugly and not useful.
Is there anyway to force re-display of the form itself in the frame like it is before the user hits submit?
THANKS!
If you can, I would advise you to drop the idea of using iframes. That depends largely on if you're using a language server-side, e.g. PHP, JSP.
If you can't, you'll need to set the action of the form to the page contained within the iframe, not the main parent page (which contains the navigation as well as the iframe).
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Alexander |
last post by:
Scroll IFrame Content to desired Position (JavaScript)
======================================
How can I scoll the content of an Ifram to a desire Position?
The function should be:...
|
by: Alexandre Jaquet |
last post by:
Hi I'm still working on iframe and now I'm
looking for the way to get and update iframe content.
example I want to do something like :
from my mainform :
...
|
by: J-T |
last post by:
Hello,
I have an iframe which its scr is set to show a url (am image) .I am put
this iframe on a user control and I am loading that user control dynamically
to my Default.aspx.Now I need to...
|
by: aatcbbtccctc |
last post by:
Hi folks
I've googled for an answer to this, with no success. Can someone please
jump in, and put me out of my misery! (I'm sure it's quite simple)
I have an invisible IFRAME, and a visible...
|
by: mike888 |
last post by:
I want to create dynamic iframe content like below but in Firefox
<iframe width="100%" height="100" src="#"></iframe>
<script language="JavaScript"><!--
document.frames.document.open();...
|
by: coat |
last post by:
hello I would like the first 200 dots of iframe content to be skipped (so the iframe content top is 200 dots from the real top). it should not be able to scroll up those 200 dots. how can that be...
|
by: jad2006 |
last post by:
Hi guys
We have a requirement like in one iframe we have to show one site and in another iframe we have to show some other external site, we did it using
<iframe src="http://www.a.com">...
|
by: perhapscwk |
last post by:
is there any ways to modify output in a iframe content?
so let say if I have a website, now due to some reasons, i need to makesure
all words like "the" become "xxx", if we can chnage all words in...
|
by: isarajeev |
last post by:
I have a aspx page, say 'abc.aspx'.
Within that page i have 4 tab controls. The tab controls open as iframe.
I also have a print option on my page.(an anchor)
<a id="aPrint" runat="server"...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |